import React from 'react'
import { 
	BrowserRouter, Switch, Route, Redirect 
} from 'react-router-dom'

import Login from "./../pages/Login.js"
import AdminLayout from "./../layouts/AdminLayout.js"
import NotFound from "./../pages/NotFound.js"
import AuthorizedRoute from "./../components/AuthorizedRoute.js"

 const MainRouter = () => (
	<BrowserRouter>    	
        <Switch>
        	<Route path="/login" component={Login} />
          	<Redirect from="/" exact to="/login"/>{/*注意redirect转向的地址要先定义好路由*/}
          	<AuthorizedRoute path="/home" component={AdminLayout} />
          	<Route component={NotFound}/>
        </Switch>
    </BrowserRouter>
)

export default MainRouter